#include <stdio.h>
#include <time.h>
#include <stdlib.h>


int main()
{
    int chess[10][10] = {0};
    
    srand(time(NULL));
    int x,y;
    int count = 0;
    while (count < 10) {
        x = rand()%10;
        y = rand()%10;

        if(chess[x][y] == 1)
            continue;
        chess[x][y] = 1;
        count++;
//        printf("count = %d\n",count);
    }
//    while (1) {
//        x = rand()%10;
//        y = rand()%10;

//        if(chess[x][y] != 1)
//            chess[x][y] = 1;
//            count++;
//            if(count == 10)
//                break;
////        printf("count = %d\n",count);
//    }
//    while (count--) {
//        x = rand()%10;
//        y = rand()%10;

//        chess[x][y] = 1;
////        printf("count = %d\n",count);
//    }
    for(int i = 0; i < 10; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            printf("%2d",chess[i][j]);
        }
        putchar(10);
    }

    int counter = 0;
    int flagGoodChess = 0;
    for(int i = 0; i < 10; i++)//横行扫描
    {
        counter = 0;
        for(int j = 0; j < 10; j++)
        {
            if(1 == chess[i][j])
            {
                counter++;
                if(counter == 3)
                {
                    flagGoodChess = 1;
                    break;
                }
            }
            else {
                counter = 0;
            }
        }
        if(flagGoodChess == 1)
        {
            break;
        }




            counter = 0;        //列扫描
            for(int j = 0; j < 10; j++)
            {
                if(1 == chess[j][i]  )
                {
                    counter++;
                    if(counter == 3)
                    {
                        flagGoodChess = 1;
                        break;
                    }
                }
                else {
                    counter = 0;
                }
            }
            if(flagGoodChess == 1)
            {
                break;
            }
    }




    if(flagGoodChess == 1)
    {
        printf("Winer！\n");
    }
    else {
        printf("Loser\n");
    }

return 0;
}
